using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using OneSoft.EntityCore;
using OneSoft.DataAccess;
using BySoft.Server.Common.Entity;
using BySoft.Server.Common.Schema;

namespace BySoft.Server.DataAccess
{
    public partial class MdProducttypeDA
    {


        private static string GetHeadSQL()
        {
            return @"SELECT A.* 
                    FROM MD_ProductType A 
                      Where 1=1";
} 
    public static DataTable SelectList(string ProductTypeID, string ProductTypeName, int pageIndex, int PageSize, out int m_count)
        {
            try
            {
                #region SQL Server
                string strcmd = GetHeadSQL();

                DataAccessParameterCollection dpc = new DataAccessParameterCollection();

                if (!string.IsNullOrEmpty(ProductTypeID))
                {
                    strcmd += " and ProductTypeID LIKE @ProductTypeID";
                    dpc.AddWithValue("@ProductTypeID", "%" + ProductTypeID + "%");
                }

                if (!string.IsNullOrEmpty(ProductTypeName))
                {
                    strcmd += " and ProductTypeName LIKE @ProductTypeName";
                    dpc.AddWithValue("@ProductTypeName", "%" + ProductTypeName + "%");
                }

                strcmd += " ORDER BY CreateDate desc,ModifyDate DESC";
                return DataAccessCommon.ExecuteDataTablePaging(strcmd, pageIndex, PageSize, dpc, out m_count);
                #endregion
            }
            catch
            {
                throw;
            }
        }
      
       
    }
}

